/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ile.DAO;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * Permite comunicarme con la base de datos
 */
public class DataSource {
   private static  EntityManager em = null;
   public static EntityManager getEntityManager(){
           if(em==null || !em.isOpen()){
               EntityManagerFactory emf = Persistence.createEntityManagerFactory("ILEPU");
               em = emf.createEntityManager();
           }
           return em;
  }
    
}
